import { Image, ImageProps } from "@tarojs/components";
import styleSheet from "./index.module.scss";

export type AbstractImageTypes =
  | "none"
  | "about-sub-page-list"
  | `corner-cut-${"square" | "wide" | "card-usage"}-${
      | "default"
      | "small"
      | "large"}`;
interface AbstractImageProps extends ImageProps {
  type: AbstractImageTypes;
  isLocal?: boolean;
}

const AbstractImage = ({
  type,
  src,
  className,
  style,
  isLocal = false,
}: AbstractImageProps) => {
  return (
    <Image
      mode="aspectFill"
      className={`${styleSheet[type]} ${className ?? ""}`}
      src={isLocal ? `/assets/images/${src}` : src}
      style={style}
    />
  );
};

export default AbstractImage;
